﻿<Window x:Class="SEToolbox.Views.WindowImportAsteroidModel"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:helix="http://helixtoolkit.codeplex.com"
        xmlns:commands="clr-namespace:SEToolbox.Services"
        xmlns:converters="clr-namespace:SEToolbox.Converters"
        xmlns:controls="clr-namespace:SEToolbox.Controls"
        ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" WindowStyle="ThreeDBorderWindow"
        Title="Import Asteroid 3D Model" Height="600" Width="800" Icon="/SEToolbox;component/app.ico" Style="{StaticResource DefaultWindowStyle}"
        commands:DialogService.IsRegisteredView="True"
        commands:DialogCloser.DialogResult="{Binding CloseResult}"
        FocusManager.FocusedElement="{Binding ElementName=uxInitialElement}">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:EnumToResouceConverter x:Key="EnumToResouceConverter"/>
        <converters:ResouceToImageConverter x:Key="ResouceToImageConverter"/>
        <converters:BusyMouseConverter x:Key="BusyMouseConverter"/>
    </Window.Resources>
    <Window.Cursor>
        <Binding Path="IsBusy" Converter="{StaticResource BusyMouseConverter}"/>
    </Window.Cursor>
    <Grid>
        <Grid Margin="0,0,0,8">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="200"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Label Content="Model:" />
                <TextBox Width="180" Text="{Binding Filename, Mode=TwoWay}" VerticalAlignment="Center" Name="uxInitialElement" Grid.Column="1"/>
                <Button ToolTip="Browse for Model" Command="{Binding Browse3DModelCommand}" VerticalAlignment="Center" Grid.Column="2">
                    <Image Width="16" Height="16" Source="{Binding Converter={StaticResource ResouceToImageConverter}, ConverterParameter=folder}" />
                </Button>
                <StackPanel Orientation="Horizontal" Grid.Column="3" Margin="8,0,0,0" Visibility="{Binding IsValidModel, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <Image Width="24" Height="24" Source="{Binding Converter={StaticResource ResouceToImageConverter}, ConverterParameter=check24}" VerticalAlignment="Center"/>
                    <TextBlock Text="" VerticalAlignment="Center" Margin="8,0,0,0"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="3" Margin="8,0,0,0" Visibility="{Binding IsWrongModel, Converter={StaticResource BooleanToVisibilityConverter}}">
                    <Image Width="24" Height="24" Source="{Binding Converter={StaticResource ResouceToImageConverter}, ConverterParameter=error24}" VerticalAlignment="Center"/>
                    <TextBlock Text="Invalid file specified" VerticalAlignment="Center" Margin="8,0,0,0"/>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="1">
                <Border BorderBrush="Black" BorderThickness="1">
                    <helix:HelixViewport3D ShowCoordinateSystem="True" ShowCameraTarget="True" ShowFieldOfView="False" ShowTriangleCountInfo="True">
                        <helix:DefaultLights/>
                        <ModelVisual3D Content="{Binding Model}">
                            <ModelVisual3D.Transform>
                                <Transform3DGroup>
                                    <RotateTransform3D>
                                        <RotateTransform3D.Rotation>
                                            <AxisAngleRotation3D Axis="0,0,1" Angle="{Binding RotateYaw}"/>
                                        </RotateTransform3D.Rotation>
                                    </RotateTransform3D>
                                    <RotateTransform3D>
                                        <RotateTransform3D.Rotation>
                                            <AxisAngleRotation3D Axis="0,-1,0" Angle="{Binding RotatePitch}"/>
                                        </RotateTransform3D.Rotation>
                                    </RotateTransform3D>
                                    <RotateTransform3D>
                                        <RotateTransform3D.Rotation>
                                            <AxisAngleRotation3D Axis="-1,0,0" Angle="{Binding RotateRoll}"/>
                                        </RotateTransform3D.Rotation>
                                    </RotateTransform3D>
                                    <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" />
                                </Transform3DGroup>
                            </ModelVisual3D.Transform>
                        </ModelVisual3D>
                    </helix:HelixViewport3D>
                </Border>
            </Grid>
            <TabControl Grid.Row="2">
                <TabItem Header="Scale">
                    <StackPanel Grid.Row="5" Grid.ColumnSpan="3" Orientation="Horizontal">
                        <GroupBox Header="Original Size" MinWidth="120">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="65"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="Width:" VerticalAlignment="Center" Margin="4,0" />
                                <TextBlock Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=OriginalModelSize.Width, StringFormat='{}{0:#,##0.00}'}" />
                                <TextBlock Text="Height:" VerticalAlignment="Center" Margin="4,0" Grid.Row="1" />
                                <TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=OriginalModelSize.Height, StringFormat='{}{0:#,##0.00}'}" />
                                <TextBlock Text="Depth:" VerticalAlignment="Center" Margin="4,0" Grid.Row="2" />
                                <TextBlock Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=OriginalModelSize.Depth, StringFormat='{}{0:#,##0.00}'}" />
                            </Grid>
                        </GroupBox>
                        <GroupBox Header="Orientation">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Row="0" Text="Pitch:" VerticalAlignment="Center" Margin="4,0"/>
                                <TextBox Width="80" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource textBoxInError}">
                                    <TextBox.Text>
                                        <Binding Path="RotatePitch" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                                            <Binding.ValidationRules>
                                                <converters:RangeRuleD Min="-360" Max="360"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBlock Text="Yaw:" Grid.Row="1" VerticalAlignment="Center" Margin="4,0"/>
                                <TextBox Width="80" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource textBoxInError}">
                                    <TextBox.Text>
                                        <Binding Path="RotateYaw" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                                            <Binding.ValidationRules>
                                                <converters:RangeRuleD Min="-360" Max="360"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <TextBlock Grid.Row="2" Text="Roll:" VerticalAlignment="Center" Margin="4,0"/>
                                <TextBox Width="80" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource textBoxInError}">
                                    <TextBox.Text>
                                        <Binding Path="RotateRoll" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                                            <Binding.ValidationRules>
                                                <converters:RangeRuleD Min="-360" Max="360"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                            </Grid>
                        </GroupBox>

                        <GroupBox Header="Scale" MinWidth="120">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <RadioButton Content="Multiply:" IsChecked="{Binding IsMultipleScale}" />
                                <TextBox Width="80" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource textBoxInError}">
                                    <TextBox.Text>
                                        <Binding Path="MultipleScale" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                                            <Binding.ValidationRules>
                                                <converters:RangeRuleD Min="0" Max="10000"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                                <RadioButton Content="Max Length:" Grid.Row="1" IsChecked="{Binding IsMaxLengthScale}"/>
                                <TextBox Width="80" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource textBoxInError}" ToolTip="This specifies the longest dimension of the structure.">
                                    <TextBox.Text>
                                        <Binding Path="MaxLengthScale" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
                                            <Binding.ValidationRules>
                                                <converters:RangeRuleD Min="5" Max="10240"/>
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </TextBox.Text>
                                </TextBox>
                            </Grid>
                        </GroupBox>

                        <GroupBox Header="Approximate New Size" MinWidth="120" Margin="8,0,0,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="60"/>
                                    <ColumnDefinition Width="60"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="1" Text="Blocks" HorizontalAlignment="Right" />
                                <TextBlock Grid.Column="2" Text="Meters" HorizontalAlignment="Right" />
                                <TextBlock Grid.Row="1" Text="Width:" Margin="0,0,0,0" VerticalAlignment="Center"/>
                                <TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelSize.Width, StringFormat='{}{0:#,##0}'}" />
                                <TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelScale.X, StringFormat='{}{0:#,##0.0}'}" />
                                <TextBlock Grid.Row="2" Text="Height:" Margin="0,0,0,0" VerticalAlignment="Center" />
                                <TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelSize.Height, StringFormat='{}{0:#,##0}'}" />
                                <TextBlock Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelScale.Y, StringFormat='{}{0:#,##0.0}'}" />
                                <TextBlock Grid.Row="3" Text="Depth:" Margin="0,0,0,0" VerticalAlignment="Center" />
                                <TextBlock Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelSize.Depth, StringFormat='{}{0:#,##0}'}" />
                                <TextBlock Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=NewModelScale.Z, StringFormat='{}{0:#,##0.0}'}" />
                            </Grid>
                        </GroupBox>
                    </StackPanel>
                </TabItem>
                <TabItem Header="Quality/Speed">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Label Content="Trace Type:" Grid.Row="0"/>
                        <ComboBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding Source={StaticResource TraceTypeEnum}}" SelectedValue="{Binding TraceType}" Margin="0,1,0,3" ToolTip="Affects the balance of symmetrical model, whether the voxels generated are odd or even from the origin.  Visually you may not see any difference on large asteroids.">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=., Converter={StaticResource EnumToResouceConverter}}" />
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                        <Label Grid.Row="1" Grid.Column="0" Content="Trace Directions:"/>
                        <ComboBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding Source={StaticResource TraceDirectionEnum}}" SelectedValue="{Binding TraceDirection}" Margin="0,1,0,3" ToolTip="Specifies the direction of rays. Having rays from all 3 directions takes 3 times longer but produces a more accurate conversion for highly detailed models.">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=., Converter={StaticResource EnumToResouceConverter}}" />
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                        <!--<Label Content="Trace Count:" Grid.Row="2"/>
                        <ComboBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding Source={StaticResource TraceIdEnum}}" SelectedValue="{Binding TraceCount}" Margin="0,1,0,3">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=., Converter={StaticResource EnumToResouceConverter}}" />
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>-->
                    </Grid>
                </TabItem>
                <TabItem Header="Position">
                    <Grid Margin="8">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="8"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <RadioButton IsChecked="{Binding IsAbsolutePosition}" Content="Absolute" />
                        <Grid Grid.Row="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Label Content="X:" Margin="0,0,4,0" VerticalAlignment="Center" />
                            <TextBox Grid.Column="1" MinWidth="80" Width="100" VerticalAlignment="Center" Text="{Binding Path=Position.X, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <Label Content="Y:" Margin="0,0,4,0" Grid.Row="1" VerticalAlignment="Center" />
                            <TextBox Grid.Column="1" Grid.Row="1" MinWidth="80" Width="100" VerticalAlignment="Center" Text="{Binding Path=Position.Y, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <Label Content="Z:" Margin="0,0,4,0" Grid.Row="2"  VerticalAlignment="Center"/>
                            <TextBox Grid.Column="1" Grid.Row="2" MinWidth="80" Width="100" VerticalAlignment="Center" Text="{Binding Path=Position.Z, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </Grid>
                        <Separator Grid.Column="1" Grid.RowSpan="2" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Width="1"/>
                        <RadioButton Grid.Column="2" IsChecked="{Binding IsInfrontofPlayer}" Content="In front of Player"/>
                        <Grid Grid.Column="2" Grid.Row="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Label Content="Distance:" Grid.Row="2" />
                            <TextBox Grid.Column="1" MinWidth="80" Grid.Row="2" Text="{Binding BuildDistance}" ToolTip="Distance in front of Player in Meters." />
                        </Grid>

                    </Grid>

                </TabItem>
                <TabItem Header="Materials">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Column="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <!--Import To Asteroid settings-->
                            <Label Grid.Row="2" Grid.Column="0" Content="Material Inside:"/>
                            <ComboBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding InsideMaterialsCollection}" SelectedValue="{Binding InsideStockMaterial}" DisplayMemberPath="DisplayName"/>

                            <Label Grid.Row="3" Grid.Column="0" Content="Material Shell:"/>
                            <ComboBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding OutsideMaterialsCollection}" SelectedValue="{Binding OutsideStockMaterial}" DisplayMemberPath="DisplayName"/>

                            <Label Grid.Row="4" Grid.Column="0" Content="Depth of shell material :"/>
                            <TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="200">
                                <TextBox.Text>
                                    <Binding Path="OutsideMaterialDepth" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
                                        <Binding.ValidationRules>
                                            <converters:RangeRuleI Min="1" Max="10"/>
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                            </TextBox>
                        </Grid>
                        <!--<ListView Grid.Column="1" ItemsSource="{Binding VolmeticMapList, Mode=OneWay}" SelectedValue="{Binding SelectedVolmeticMapList}">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Width="40" Header="Move">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <Border Width="20" Height="16" BorderBrush="Black" BorderThickness="0">
                                                    <Grid>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition/>
                                                            <RowDefinition/>
                                                        </Grid.RowDefinitions>
                                                        <Button Grid.Row="0" ToolTip="Move Up" Style="{StaticResource SpinUpButton}" Command="{Binding TestCommand}"/>
                                                        <Button Grid.Row="1" ToolTip="Move Down" Style="{StaticResource SpinDownButton}" Command="{Binding TestCommand}"/>
                                                    </Grid>
                                                </Border>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Layers" DisplayMemberBinding="{Binding GeometryIndex}" Width="40"/>
                                    <GridViewColumn Width="60" Header="Color">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <Border Width="16" Height="16" Background="{Binding BrushColor}" BorderBrush="Black" BorderThickness="1"/>
                                                    <Button Margin="4,0,0,0" Content="Edit" Command="{Binding TestCommand}" />
                                                </StackPanel>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Ore Shell" DisplayMemberBinding="{Binding ShellAsteroidMaterial}" Width="40"/>
                                    <GridViewColumn Header="Ore Inside" DisplayMemberBinding="{Binding FillAsteroidMaterial}" Width="40"/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <Grid Grid.Column="2">
                            <Border Width="20" Height="16" BorderBrush="Black" BorderThickness="1">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <Button Grid.Row="0" ToolTip="Move Up" Style="{StaticResource SpinUpButton}" />
                                    <Button Grid.Row="1" ToolTip="Move Down" Style="{StaticResource SpinDownButton}" />
                                </Grid>
                            </Border>
                        </Grid>-->
                    </Grid>
                </TabItem>
                <TabItem Header="Processing">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Column="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Row="0" Grid.Column="0" Content="Beep when finished:"/>
                            <CheckBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding BeepWhenFinished}"/>

                            <Label Grid.Row="1" Grid.Column="0" Content="Run in low priority:"/>
                            <CheckBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding RunInLowPrioity}"/>

                            <Label Grid.Row="2" Grid.Column="0" Content="Save when finished:"/>
                            <CheckBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding SaveWhenFinsihed}"/>
                        </Grid>
                    </Grid>
                </TabItem>
            </TabControl>
            <StackPanel Grid.Row="3" Orientation="Horizontal" Height="28" Margin="8,8" HorizontalAlignment="Right">
                <Button Width="90" Command="{Binding CreateCommand}" Content="Create" IsDefault="True"/>
                <Button Margin="8,0,0,0" Width="90" Command="{Binding CancelCommand}" Content="Cancel" IsCancel="True"/>
            </StackPanel>
        </Grid>
        <controls:BusyIndicator Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}" />
    </Grid>
</Window>